package com.kingyea.gradle.extension;

import java.util.HashMap;
import java.util.Map;
import static com.kingyea.gradle.constant.ConstantValues.*;

//已完成
public class Deployer {

	private String deployPath;
	private String libDeployPath;
	private String etcDeployPath;
	private String binDeployPath;
	private Svn svn;
	private String resourcePath;
	private String varPath;
	private Map<String, Object> globalDeployConfigs;
	private Map<String, Object> windowsDeployConfigs;
	private Map<String, Object> linuxDeployConfigs;
	private String targetOs;
	private String targetOsArch;
	private String distribution;
	private String embedJdk;
	
	public Deployer() {
		this.targetOs  = OS_LINUX;
		this.targetOsArch = ARCH_X64;
	}
	
	public Map<String, Object> getDeployConfigs() {
		Map<String, Object> deployConfigs = new HashMap<String, Object>();
		if(getGlobalDeployConfigs()!=null) {
			deployConfigs.putAll(globalDeployConfigs);
		}
		if(OS_WIN.equals(getTargetOs()) && getWindowsDeployConfigs()!=null) {
			deployConfigs.putAll(getWindowsDeployConfigs());
		}
		if(OS_LINUX.equals(getTargetOs()) && getLinuxDeployConfigs()!=null) {
			deployConfigs.putAll(getLinuxDeployConfigs());
		}
		return deployConfigs;
	}

	public String getDeployPath() {
		return deployPath;
	}

	public void setDeployPath(String deployPath) {
		this.deployPath = deployPath;
	}

	public String getLibDeployPath() {
		return libDeployPath!=null ? libDeployPath : deployPath + "/libs";
	}

	public void setLibDeployPath(String libDeployPath) {
		this.libDeployPath = libDeployPath;
	}

	public String getEtcDeployPath() {
		return etcDeployPath!=null ? etcDeployPath : deployPath + "/etc";
	}

	public void setEtcDeployPath(String etcDeployPath) {
		this.etcDeployPath = etcDeployPath;
	}

	public String getBinDeployPath() {
		return binDeployPath!=null ? binDeployPath : deployPath + "/bin";
	}

	public void setBinDeployPath(String binDeployPath) {
		this.binDeployPath = binDeployPath;
	}

	public Svn getSvn() {
		return svn;
	}

	public void setSvn(Svn svn) {
		this.svn = svn;
	}

	public String getResourcePath() {
		return resourcePath;
	}
	public String getResPath() {
		return resourcePath;
	}
	public String getResourcesPath() {
		return resourcePath;
	}

	public void setResourcePath(String resourcePath) {
		this.resourcePath = resourcePath;
	}
	public void setResPath(String resourcePath) {
		this.resourcePath = resourcePath;
	}
	public void setResourcesPath(String resourcePath) {
		this.resourcePath = resourcePath;
	}

	public String getVarPath() {
		return varPath!=null ? varPath : deployPath + "/var";
	}

	public void setVarPath(String varPath) {
		this.varPath = varPath;
	}

	public Map<String, Object> getGlobalDeployConfigs() {
		return globalDeployConfigs;
	}

	public void setGlobalDeployConfigs(Map<String, Object> globalDeployConfigs) {
		this.globalDeployConfigs = globalDeployConfigs;
	}

	public Map<String, Object> getWindowsDeployConfigs() {
		return windowsDeployConfigs;
	}

	public void setWindowsDeployConfigs(Map<String, Object> windowsDeployConfigs) {
		this.windowsDeployConfigs = windowsDeployConfigs;
	}

	public Map<String, Object> getLinuxDeployConfigs() {
		return linuxDeployConfigs;
	}

	public void setLinuxDeployConfigs(Map<String, Object> linuxDeployConfigs) {
		this.linuxDeployConfigs = linuxDeployConfigs;
	}

	public String getTargetOs() {
		return targetOs;
	}

	public void setTargetOs(String targetOs) {
		this.targetOs = targetOs;
	}

	public String getTargetOsArch() {
		return targetOsArch;
	}

	public void setTargetOsArch(String targetOsArch) {
		this.targetOsArch = targetOsArch;
	}

	public String getDistribution() {
		return distribution;
	}

	public void setDistribution(String distribution) {
		this.distribution = distribution;
	}

	public String getEmbedJdk() {
		return embedJdk;
	}

	public void setEmbedJdk(String embedJdk) {
		this.embedJdk = embedJdk;
	}
	
}
